<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class User extends Controller {

	function User()
    {
    	parent::Controller();
    	$this->load->helper(array('url'));
    }
    
    function login() 
	{
		$this->load->library('form_validation');
		$fields['username'] = "username";
		
		$this->form_validation->set_rules('username', 'Username', 'required');
		$this->form_validation->set_rules('password', 'Password', 'callback_check_login');
	
		if ($this->form_validation->run()) 
		{
			redirect('home', 'refresh');
		} 
		else 
		{
			redirect('home', 'refresh');
		}
	}
	
	function logout()
	{
		$this->auth->logout();
		redirect('home');
	}
	
	function check_login()
	{
		$username = $this->input->post('username');
		$password = $this->input->post('password');
		
		return $this->auth->login($username, $password);
	}

}
/* End of file user.php */
/* Location: /application/controllers/login.php */